package javamusic.Servlet.Pedido;

import java.io.IOException;

import javamusic.excepcion.DAOExcepcion;
import javamusic.negocio.GestionPedido;
import javamusic.negocio.GestionProducto;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ServletPedidoInsertarPro
 */
@WebServlet("/ServletPedidoInsertarPro")
public class ServletPedidoInsertarPro extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ServletPedidoInsertarPro() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		int  idpedido = Integer.parseInt(request.getParameter("idpedido"));
		String  tipo = request.getParameter("tipo");	
		int  cantidad = Integer.parseInt(request.getParameter("cantidad"));
		String  fecha = request.getParameter("fecha");
		int  idcliente = Integer.parseInt(request.getParameter("idcliente"));
		int  idcomprobante = Integer.parseInt(request.getParameter("idcomprobante"));
		
		GestionPedido negocio = new GestionPedido();  
		
		try {
			negocio.PedidoInsertar(idpedido, tipo, cantidad, fecha, idcliente, idcomprobante);
			RequestDispatcher rd = request.getRequestDispatcher("FormPedidoInicio.jsp");
			rd.forward(request, response);
		} catch (DAOExcepcion e) {
		}
	}

}
